home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 4.4 KB | 149 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWRRcShp.h
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 3/28/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWRRCSHP_H
- #define FWRRCSHP_H
-
- #ifndef FWSHAPE_H
- #include "FWShape.h"
- #endif
-
- #ifndef FWBNDSHP_H
- #include "FWBndShp.h"
- #endif
-
- //==============================================================================
- // •• Forward Declarations
- //==============================================================================
-
- class FW_CGraphicContext;
- class FW_CRoundRectShapeRep;
- class FW_CRectShape;
- class FW_COvalShape;
- class FW_CArcShape;
- class FW_CLineShape;
- class FW_CRegionShape;
-
- //========================================================================================
- // •• CLASS FW_CRoundRectShape
- //========================================================================================
-
- class FW_CRoundRectShape : public FW_CShape
- {
- //----------------------------------------------------------------------------------------
- // • Constructors
- //
- public:
- FW_CRoundRectShape();
- FW_CRoundRectShape(const FW_CRect& rect, const FW_CPoint& ovalSize);
-
- FW_CRoundRectShape(const FW_CRoundRectShape& other);
- FW_CRoundRectShape(FW_CRoundRectShapeRep* rep);
-
- //----------------------------------------------------------------------------------------
- // • operators
- //
- public:
- FW_CRoundRectShape& operator=(const FW_CRoundRectShape& other);
- FW_CRoundRectShape& operator=(FW_CRoundRectShapeRep* other);
-
- FW_CRoundRectShapeRep* operator->() const
- {return (FW_CRoundRectShapeRep*)GetRep();}
-
- //----------------------------------------------------------------------------------------
- // • Conversion
- //
- public:
- operator FW_CRectShape() const;
- operator FW_COvalShape() const;
- operator FW_CArcShape() const;
- operator FW_CLineShape() const;
- operator FW_CRegionShape() const;
-
- //----------------------------------------------------------------------------------------
- // • Static Methods
- //
- public:
- static void DrawRoundRect(FW_CGraphicContext* graphicContext,
- const FW_CRect& rect,
- const FW_CPoint& ovalSize);
- };
-
- //==============================================================================
- // •• class FW_CRoundRectShapeRep
- //==============================================================================
-
- class FW_CRoundRectShapeRep : public FW_CBoundedShapeRep
- {
- friend class FW_CRoundRectShape;
-
- //------------------------------------------------------------------------------
- // • Constructors/Destructors
- //
- protected:
- FW_CRoundRectShapeRep();
- FW_CRoundRectShapeRep(const FW_CRect& rect, const FW_CPoint& ovalSize);
-
- virtual ~FW_CRoundRectShapeRep();
-
- //------------------------------------------------------------------------------
- // • Inherited API
- //
- public:
- // ----- Hit Testing -----
- virtual FW_HitTestPart HitTest(const FW_CPoint& test) const;
-
- // ----- Rendering -----
- virtual void Draw(FW_CGraphicContext* gc);
- static void DrawRoundRect(FW_CGraphicContext* gc,
- const FW_CRect& rect,
- const FW_CPoint& ovalSize);
-
- // ----- Default shape -----
- virtual void SetAsDefault() const;
-
- // ----- Stream -----
- virtual void Flatten(FW_CWritableStream& stream);
- virtual void Unflatten(FW_CReadableStream& stream);
-
- //------------------------------------------------------------------------------
- // • New API
- //
- public:
- FW_CRoundRectShape Copy() const;
-
- FW_CPoint GetOvalSize() const
- {return fOvalSize;}
- void SetOvalSize(const FW_CPoint& ovalSize)
- {fOvalSize = ovalSize; Changed();}
-
- //------------------------------------------------------------------------------
- // • Data Members
- //
- private:
- FW_CPoint fOvalSize;
- };
-
- //==============================================================================
- // •• Inlines
- //==============================================================================
-
- //------------------------------------------------------------------------------
- // • FW_CRoundRectShape::DrawRoundRect
- //------------------------------------------------------------------------------
- inline static void FW_CRoundRectShape::DrawRoundRect(FW_CGraphicContext* graphicContext,
- const FW_CRect& rect,
- const FW_CPoint& ovalSize)
- {
- FW_CRoundRectShapeRep::DrawRoundRect(graphicContext, rect, ovalSize);
- }
-
- #endif